using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SilverSea.Video.Tools
{
	public class Wizard : Form
	{
		private IContainer icontainer_0;
		private Panel panel1;
		private Label descriptionLabel;
		private Panel panel2;
		private Button btnBack;
		private Button btnFinish;
		private Button btnCancel;
		private Button btnNext;
		private Panel workPanel;
		private Panel panel3;
		private string string_0;
		private int int_0;
		private Control control_0;
		public Wizard()
		{
			this.InitializeComponent();
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Wizard));
            this.panel1 = new System.Windows.Forms.Panel();
            this.descriptionLabel = new System.Windows.Forms.Label();
            this.panel2 = new System.Windows.Forms.Panel();
            this.btnBack = new System.Windows.Forms.Button();
            this.btnFinish = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.btnNext = new System.Windows.Forms.Button();
            this.workPanel = new System.Windows.Forms.Panel();
            this.panel3 = new System.Windows.Forms.Panel();
            this.panel1.SuspendLayout();
            this.panel2.SuspendLayout();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.SystemColors.Control;
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel1.Controls.Add(this.descriptionLabel);
            resources.ApplyResources(this.panel1, "panel1");
            this.panel1.Name = "panel1";
            // 
            // descriptionLabel
            // 
            resources.ApplyResources(this.descriptionLabel, "descriptionLabel");
            this.descriptionLabel.Name = "descriptionLabel";
            // 
            // panel2
            // 
            this.panel2.BackColor = System.Drawing.SystemColors.Control;
            this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel2.Controls.Add(this.btnBack);
            this.panel2.Controls.Add(this.btnFinish);
            this.panel2.Controls.Add(this.btnCancel);
            this.panel2.Controls.Add(this.btnNext);
            resources.ApplyResources(this.panel2, "panel2");
            this.panel2.Name = "panel2";
            // 
            // btnBack
            // 
            resources.ApplyResources(this.btnBack, "btnBack");
            this.btnBack.Name = "btnBack";
            this.btnBack.UseVisualStyleBackColor = true;
            this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
            // 
            // btnFinish
            // 
            resources.ApplyResources(this.btnFinish, "btnFinish");
            this.btnFinish.Name = "btnFinish";
            this.btnFinish.UseVisualStyleBackColor = true;
            this.btnFinish.Click += new System.EventHandler(this.btnFinish_Click);
            // 
            // btnCancel
            // 
            resources.ApplyResources(this.btnCancel, "btnCancel");
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.UseVisualStyleBackColor = true;
            // 
            // btnNext
            // 
            resources.ApplyResources(this.btnNext, "btnNext");
            this.btnNext.Name = "btnNext";
            this.btnNext.UseVisualStyleBackColor = true;
            this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
            // 
            // workPanel
            // 
            this.workPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            resources.ApplyResources(this.workPanel, "workPanel");
            this.workPanel.Name = "workPanel";
            // 
            // panel3
            // 
            this.panel3.BackColor = System.Drawing.SystemColors.ActiveCaption;
            this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            resources.ApplyResources(this.panel3, "panel3");
            this.panel3.Name = "panel3";
            // 
            // Wizard
            // 
            this.AcceptButton = this.btnNext;
            this.CancelButton = this.btnCancel;
            resources.ApplyResources(this, "$this");
            this.Controls.Add(this.workPanel);
            this.Controls.Add(this.panel3);
            this.Controls.Add(this.panel2);
            this.Controls.Add(this.panel1);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Wizard";
            this.Load += new System.EventHandler(this.Wizard_Load);
            this.panel1.ResumeLayout(false);
            this.panel2.ResumeLayout(false);
            this.ResumeLayout(false);

		}
		public void AddPage(IWizardPage page)
		{
			Control control = (Control)page;
			this.workPanel.Controls.Add(control);
			control.Dock = DockStyle.Fill;
			page.StateChanged += new EventHandler(this.method_2);
			page.Reset += new EventHandler(this.method_3);
		}
		private void Wizard_Load(object sender, EventArgs e)
		{
			this.string_0 = this.Text;
			this.method_1(0);
		}
		private void method_0()
		{
			this.btnBack.Enabled = (this.int_0 != 0);
			this.btnNext.Enabled = (this.int_0 < this.workPanel.Controls.Count - 1 && this.control_0 != null && ((IWizardPage)this.control_0).Completed);
			this.btnFinish.Enabled = true;
			foreach (IWizardPage wizardPage in this.workPanel.Controls)
			{
				if (!wizardPage.Completed)
				{
					this.btnFinish.Enabled = false;
					break;
				}
			}
		}
		private void method_1(int int_1)
		{
			this.OnPageChanging(int_1);
			if (this.control_0 != null)
			{
				this.control_0.Hide();
			}
			this.int_0 = int_1;
			this.Text = string.Concat(new string[]
			{
				this.string_0,
				" - Page ",
				(int_1 + 1).ToString(),
				" of ",
				this.workPanel.Controls.Count.ToString()
			});
			if (this.workPanel.Controls.Count > 0)
			{
				this.control_0 = this.workPanel.Controls[this.int_0];
				IWizardPage wizardPage = (IWizardPage)this.control_0;
				this.control_0.Show();
				this.descriptionLabel.Text = wizardPage.PageDescription;
				wizardPage.Display();
				this.method_0();
			}
		}
		private void btnNext_Click(object sender, EventArgs e)
		{
			if (((IWizardPage)this.control_0).Apply() && this.int_0 < this.workPanel.Controls.Count - 1)
			{
				this.method_1(this.int_0 + 1);
			}
		}
		private void btnBack_Click(object sender, EventArgs e)
		{
			if (this.int_0 > 0)
			{
				this.method_1(this.int_0 - 1);
			}
		}
		private void btnFinish_Click(object sender, EventArgs e)
		{
			if (((IWizardPage)this.control_0).Apply())
			{
				this.OnFinish();
				base.DialogResult = DialogResult.OK;
				base.Close();
			}
		}
		private void method_2(object sender, EventArgs e)
		{
			this.method_0();
		}
		private void method_3(object sender, EventArgs e)
		{
			this.OnResetOnPage(this.workPanel.Controls.GetChildIndex((Control)sender));
			this.method_0();
		}
		protected virtual void OnPageChanging(int page)
		{
		}
		protected virtual void OnResetOnPage(int page)
		{
		}
		protected virtual void OnFinish()
		{
		}
	}
}
